package com.jlboot.app.admin.controller.sys;

import com.jlboot.core.annotation.JlActivity;
import com.jlboot.core.json.JsonResult;
import com.jlboot.app.admin.base.BaseController;
import com.jlboot.core.form.FormData;
import com.jlboot.app.admin.util.SysInfoUtil;

/**
 * Created by 51594 on 2022/3/2.
 */
public class SysInfoController extends BaseController {

    @JlActivity( name = "", log = false)
    public void index() {
        renderText("默认");
    }


    /**
     * 查看系统信息
     */
    
    public void SysInfoList() {
        FormData fd = FormData.n();
        fd.addData("memory", SysInfoUtil.getMemoryInfo());
        // fd.addData("cpu", SysInfoUtil.getCpuInfo());
        setAttr("form", fd);
        render("SysInfoList.html");
    }

    /**
     * 取得cpu信息
     */
    
    public void getCpuInfoApi() {
        renderJson(JsonResult.okWithMsg("成功").setData(SysInfoUtil.getCpuInfo()));
    }


    /**
     * 取得cpu信息
     */
    
    public void getMemoryInfoApi() {
        renderJson(JsonResult.okWithMsg("成功").setData(SysInfoUtil.getMemoryInfo()));
    }

    /**
     * 取得服务器信息
     */
    
    public void getServInfoApi() {
        renderJson(JsonResult.okWithMsg("成功").setData(SysInfoUtil.getSystemInfo()));
    }

    /**
     * 取得服务器信息
     */
    
    public void getDiskInfoApi() {
        renderJson(JsonResult.okWithMsg("成功").setData(SysInfoUtil.getFileSystem()));
    }
}
